package cn.com.device.monitor.vo;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Data
public class DeviceVO {
    //数据库
   private String deviceId;
   // 设备检测数据
   private List<KeyValueVO> params;

   public List<String> getMeasurements(){
       if(null == params || params.size() ==0){
           return new ArrayList<>();
       }
       return params.stream().map(KeyValueVO ::getCode).collect(Collectors.toList());
   }

    public List<String> getValues(){
        if(null == params || params.size() ==0){
            return new ArrayList<>();
        }
        return params.stream().map(KeyValueVO ::getValue).collect(Collectors.toList());
    }
}
